<?php
  class Keke_witkey_currencies_class{
        public $_db;
        public $_tablename;
	    public $_dbop;
	    	 public $_currencies_id;  		 public $_title; 		 public $_code; 		 public $_symbol_left; 		 public $_symbol_right; 		 public $_decimal_point; 		 public $_thousands_point; 		 public $_decimal_places; 		 public $_value; 		 public $_last_updated; 
	    public $_cache_config = array ('is_cache' => 0, 'time' => 0 );
	    public $_replace=0;  
	    public $_where;      
	     function  keke_witkey_currencies_class(){ 			 $this->_db = new db_factory ( );			 $this->_dbop = $this->_db->create(DBTYPE);			 $this->_tablename = TABLEPRE."witkey_currencies";		 }	    
	    		public function getCurrencies_id(){			 return $this->_currencies_id ;		}		public function getTitle(){			 return $this->_title ;		}		public function getCode(){			 return $this->_code ;		}		public function getSymbol_left(){			 return $this->_symbol_left ;		}		public function getSymbol_right(){			 return $this->_symbol_right ;		}		public function getDecimal_point(){			 return $this->_decimal_point ;		}		public function getThousands_point(){			 return $this->_thousands_point ;		}		public function getDecimal_places(){			 return $this->_decimal_places ;		}		public function getValue(){			 return $this->_value ;		}		public function getLast_updated(){			 return $this->_last_updated ;		}		public function getWhere(){			 return $this->_where ;		}		public function getCache_config() {			return $this->_cache_config;		}
	    		public function setCurrencies_id($value){ 			 $this->_currencies_id = $value;		}		public function setTitle($value){ 			 $this->_title = $value;		}		public function setCode($value){ 			 $this->_code = $value;		}		public function setSymbol_left($value){ 			 $this->_symbol_left = $value;		}		public function setSymbol_right($value){ 			 $this->_symbol_right = $value;		}		public function setDecimal_point($value){ 			 $this->_decimal_point = $value;		}		public function setThousands_point($value){ 			 $this->_thousands_point = $value;		}		public function setDecimal_places($value){ 			 $this->_decimal_places = $value;		}		public function setValue($value){ 			 $this->_value = $value;		}		public function setLast_updated($value){ 			 $this->_last_updated = $value;		}		public function setWhere($value){ 			 $this->_where = $value;		}		public function setCache_config($_cache_config) {			 $this->_cache_config = $_cache_config; 		}
    	   public  function __set($property_name, $value) {
		 		$this->$property_name = $value; 
			}
			public function __get($property_name) { 
				if (isset ( $this->$property_name )) { 
					return $this->$property_name; 
				} else { 
					return null; 
				} 
			}
	    		function create_keke_witkey_currencies(){		 		 $data =  array(); 					if(!is_null($this->_currencies_id)){ 				 $data['currencies_id']=$this->_currencies_id;			}			if(!is_null($this->_title)){ 				 $data['title']=$this->_title;			}			if(!is_null($this->_code)){ 				 $data['code']=$this->_code;			}			if(!is_null($this->_symbol_left)){ 				 $data['symbol_left']=$this->_symbol_left;			}			if(!is_null($this->_symbol_right)){ 				 $data['symbol_right']=$this->_symbol_right;			}			if(!is_null($this->_decimal_point)){ 				 $data['decimal_point']=$this->_decimal_point;			}			if(!is_null($this->_thousands_point)){ 				 $data['thousands_point']=$this->_thousands_point;			}			if(!is_null($this->_decimal_places)){ 				 $data['decimal_places']=$this->_decimal_places;			}			if(!is_null($this->_value)){ 				 $data['value']=$this->_value;			}			if(!is_null($this->_last_updated)){ 				 $data['last_updated']=$this->_last_updated;			}			 return $this->_currencies_id = $this->_db->inserttable($this->_tablename,$data,1,$this->_replace); 		 } 
	    		function edit_keke_witkey_currencies(){ 		 		 $data =  array();  					if(!is_null($this->_currencies_id)){ 				 $data['currencies_id']=$this->_currencies_id;			}			if(!is_null($this->_title)){ 				 $data['title']=$this->_title;			}			if(!is_null($this->_code)){ 				 $data['code']=$this->_code;			}			if(!is_null($this->_symbol_left)){ 				 $data['symbol_left']=$this->_symbol_left;			}			if(!is_null($this->_symbol_right)){ 				 $data['symbol_right']=$this->_symbol_right;			}			if(!is_null($this->_decimal_point)){ 				 $data['decimal_point']=$this->_decimal_point;			}			if(!is_null($this->_thousands_point)){ 				 $data['thousands_point']=$this->_thousands_point;			}			if(!is_null($this->_decimal_places)){ 				 $data['decimal_places']=$this->_decimal_places;			}			if(!is_null($this->_value)){ 				 $data['value']=$this->_value;			}			if(!is_null($this->_last_updated)){ 				 $data['last_updated']=$this->_last_updated;			}			if($this->_where){ 				 return $this->_db->updatetable($this->_tablename,$data,$this->getWhere()); 			 } 			 else{ 				 $where = array('currencies_id' => $this->_currencies_id); 				 return $this->_db->updatetable($this->_tablename,$data,$where); 			} 		 } 
	    		function query_keke_witkey_currencies($is_cache=0, $cache_time=0){ 			 if($this->_where){ 				 $sql = "select * from $this->_tablename where ".$this->_where; 			 } 			 else{ 				 $sql = "select * from $this->_tablename"; 			 } 			if ($is_cache) {			 $this->_cache_config ['is_cache'] = $is_cache;			}			if ($cache_time) {			 $this->_cache_config ['time'] = $cache_time;			 }			 if ($this->_cache_config ['is_cache']) {			     if (CACHE_TYPE) {					 $keke_cache = new keke_cache_class ( CACHE_TYPE );					 $id = $this->_tablename . ($this->_where?"_" .substr(md5 ( $this->_where ),0,6):'');						$data = $keke_cache->get ( $id );							if ($data) {								return $data; 							} else { 								$res = $this->_dbop->query ( $sql ); 								$keke_cache->set ( $id, $res,$this->_cache_config['time'] ); 					 			$this->_where = ""; 								return $res; 							} 						} 			 }else{			 	$this->_where = ""; 				return  $this->_dbop->query ( $sql ); 			 }		 } 
	    		function count_keke_witkey_currencies(){ 			 if($this->_where){ 				 $sql = "select count(*) as count from $this->_tablename where ".$this->_where; 			 } 			 else{ 				 $sql = "select count(*) as count from $this->_tablename"; 			 } 			 $this->_where = ""; 			 return $this->_dbop->getCount($sql); 		 } 
	    		function del_keke_witkey_currencies(){ 			 if($this->_where){ 				 $sql = "delete from $this->_tablename where ".$this->_where; 			 } 			 else{ 				 $sql = "delete from $this->_tablename where currencies_id = $this->_currencies_id "; 			 } 			 $this->_where = ""; 			 return $this->_dbop->execute($sql); 		 } 
   }
 ?>